{extend name="common/base_page" /}

{block name="title"}搜索{/block}

{block name="jscssfile"}{/block}

{block name="css"}
<style type="text/css"></style>
{/block}

{block name="body"}
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card layadmin-serach-main">
          <div class="layui-card-header">
            <p style="font-size: 18px;">
              <span style="color: #01AAED">{$word}</span> 搜索到 
              <strong id="result_num">0</strong> 个结果
            </p>
          </div>
          <div class="layui-card-body">
            
            <ul class="layadmin-serach-list layui-text">

              <div class="layui-serachlist-noresult">请稍候，正在搜索...</div>

            </ul>
            <div id="layer_page_box" style="text-align:left;"></div>
            
          </div>
        </div>
      </div>
    </div>
  </div>
{/block}

{block name="script"}
<script type="text/javascript">
var _p = 1;
$(function(){
  setTimeout(function(){
      //加载列表
      _loadSearchList();
  },100);
});
//加载列表
function _loadSearchList()
{
  _Index.ajax("{:url('index/index/search')}",{searchword:'{$word}',page:_p},function(d){
    if(d.err == 0)
    {
      $('#result_num').html(d.total);
      var _html = '';
      $.each(d.list,function(i,v){
        _html += '<li>\
          <div class="layui-serachlist-text">\
            <h3><a href="'+v.url+'">'+v.title+'</a></h3>\
            <p>时间：<em>' + v.create_time + '</em></p>\
            <p>\
              <span class="layui-badge layui-bg-green">功能菜单</span>\
            </p>\
          </div>\
        </li>';
      });
      $('.layadmin-serach-list').empty().append(_html);
      _Index.setPagebar(_p,d.limit,d.total,function(page){
          _p = page;
          _loadSearchList();
      });
    }else{
      $('.layadmin-serach-list').empty().append('<div class="layui-serachlist-noresult">'+d.msg+'</div>');
      layer.msg(d.msg, {time: 2000,anim: 4});
    }
  },'请稍候...');
}
</script>
{/block}